package com.walle.concurrenttest.actomic;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author zhangjiapeng
 * @Package com.walle.concurrenttest.actomic
 * @Description: ${todo}
 * @date 2019/2/15 13:49
 */
public class Test {
    public static void main(String[] args) {
        AtomicInteger storage = new AtomicInteger(50);
        Thread producer1 = new Thread(new Producer(storage));
        Thread producer2 = new Thread(new Producer(storage));


        Thread consumer1 = new Thread(new Consumer(storage));
        Thread consumer2 = new Thread(new Consumer(storage));
        Thread consumer3 = new Thread(new Consumer(storage));

        producer1.setName("producer1");
        producer2.setName("producer2");


        consumer1.setName("consumer1");
        consumer2.setName("consumer2");
        consumer3.setName("consumer3");

        producer1.start();
        producer2.start();
        consumer1.start();
    }
}
